import 'dart:ffi' as ffi;

import 'package:test/test.dart';

import 'package:napi/src/arkobject.dart' as obj_mod;
import 'package:napi/src/types.dart' as types_mod;

//ETS 注入 env 后可替换为真实 N-API 往返
void main() {
  group('ArkObject', () {
    test('null pointer detection', () {
      final obj = obj_mod.ArkObject(ffi.Pointer.fromAddress(0));
      expect(obj.isNull, isTrue);
      expect(obj.reference.address, 0);
    });

    test('non-null pointer holds address', () {
      final ptr = ffi.Pointer<ffi.Void>.fromAddress(0x1234);
      final obj = obj_mod.ArkObject(ptr);
      expect(obj.isNull, isFalse);
      expect(obj.reference, ptr);
    });
  });
}


